package com.bolt.admin.security.shiro;


import com.bolt.admin.security.shiro.jwt.UserInfo;

import java.io.Serializable;
import java.util.List;

/**
 * 存放在权限框架容器中的认证授权用户数据对象
 */

public class DefaultAuthUserDetails implements Serializable, AuthUserDetails {

    private static final long serialVersionUID = 8346793124666695534L;

    private UserInfo userInfo;

    private String key;

    private  List<String> dataScopes;
    /**
     * 用户输入的登录账号
     *
     * @return
     */
    @Override
    public String getUserName() {
        return userInfo.getUserName();
    }

    /**
     * 考虑到登录账号可能存在被修改的，为了数据排查的准确性
     * 额外把用户的唯一标识信息记录下来，以便准确的进行数据关联排查
     *
     * @return
     */
    @Override
    public String getUserId() {
        return userInfo.getUserId();
    }

    /**
     * @return
     */
    @Override
    public String getReadName() {
        return userInfo.getRealName();
    }


    @Override
    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }

    public List <String> getDataScopes() {
        return dataScopes;
    }

    public void setDataScopes(List <String> dataScopes) {
        this.dataScopes = dataScopes;
    }
}
